summon armor_stand ~ ~ ~ {Tags:[tempSAC],Invisible:true,Small:true,Marker:true,Invulnerable:true}

item replace entity @n[tag=tempSAC,distance=..1,type=armor_stand] weapon.mainhand from entity @s hotbar.8

$data modify entity @n[tag=tempSAC,distance=..1,type=armor_stand] HandItems[0].components."minecraft:custom_data".bag[$(index)].count set value $(value)

item replace entity @s hotbar.8 from entity @n[tag=tempSAC,distance=..1,type=armor_stand] weapon.mainhand

kill @n[tag=tempSAC,distance=..1,type=armor_stand]

#Count0处理
$function dab:system/arrow_bundle/storage/arrow_count/count_0 {index:$(index)}

#update
function dab:system/arrow_bundle/storage/update